Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: filter schemas by name #1135

Merged
merged 4 commits into from
Mar 25, 2024
Merged

feat: filter schemas by name #1135

merged 4 commits into from
Mar 25, 2024

Conversation

matt2e
Copy link
Collaborator

@matt2e matt2e commented Mar 25, 2024

#1090

ftl schema get --modules <modules>
eg: ftl schema get --modules time,echo

Allows filtering of schemas to the named modules.
If the input includes a module that was not found, it is returned as an error

The behaviour for these remains the same:

ftl schema
ftl schema get

@alecthomas alecthomas mentioned this pull request Mar 25, 2024
@matt2e matt2e linked an issue Mar 25, 2024 that may be closed by this pull request
@@ -1,7 +1,7 @@
package main

type schemaCmd struct {
Get getSchemaCmd `default:"" cmd:"" help:"Retrieve the cluster FTL schema."`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to preserve this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it up so we can preserve it. See the PR description for the new interface.
Or is there a way to get the non-named arg within ftl schema get with kong while maintaining the default cmd for ftl schema? I figured you'd be the expert on that ;)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that looks good!

if !msg.More {
break
}
}
for name := range remainingNames {
fmt.Fprintf(os.Stderr, "module %s not found\n", name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not formatted consistently with FTL's CLI, but just return it as an error listing all missing names, and you'll get that for free.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right it should go to stderr. --protobuf now has the same behaviour

@matt2e matt2e requested a review from alecthomas March 25, 2024 05:06
@matt2e matt2e merged commit dc2a9cd into main Mar 25, 2024
11 checks passed
@matt2e matt2e deleted the matt2e/schema-get-by-name branch March 25, 2024 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide option to specify modules in ftl schema get
2 participants